package com.zxjbyte.yiyi.extension.job.core.trigger;

import com.zxjbyte.yiyi.extension.job.enums.TriggerTypeEnum;
import com.zxjbyte.yiyi.extension.job.core.JobArgs;
import com.zxjbyte.yiyi.extension.job.core.trigger.route.CalendarIntervalTriggerHelper;
import com.zxjbyte.yiyi.extension.job.core.trigger.route.CronTriggerHelper;
import com.zxjbyte.yiyi.extension.job.core.trigger.route.DailyTimeIntervalTriggerHelper;
import com.zxjbyte.yiyi.extension.job.core.trigger.route.SimpleTriggerHelper;
import lombok.Getter;
import lombok.Setter;
import org.quartz.JobDataMap;
import org.quartz.ScheduleBuilder;
import org.quartz.Trigger;
import org.quartz.TriggerKey;

import java.util.Date;

/**
 * 触发器参数基类
 *
 * @Author zhangxingjia
 * @Date 2023/11/9 20:12
 * @Version: 1.0
 */
@Getter
@Setter
public abstract class TriggerArgs extends JobArgs {

    /**
     * 触发器时间表类型枚举
     */
    protected TriggerTypeEnum triggerTypeEnum;

    /**
     * 定义触发器时间表的ScheduleBuilder
     *
     * @see CalendarIntervalTriggerHelper
     * @see CronTriggerHelper
     * @see DailyTimeIntervalTriggerHelper
     * @see SimpleTriggerHelper
     */
    protected ScheduleBuilder<? extends Trigger> scheduleBuilder;

    // 触发器的triggerKey（未设置将将生成一个随机的、唯一的TriggerKey）
    protected TriggerKey triggerKey;

    // 触发器的jobDataMap（作业实例的状态信息）
    protected final JobDataMap jobDataMap = new JobDataMap();

    // 触发器的开始时间
    protected Date triggerStartTime;

    // 触发器的开始时间是否设置为当前时间
    protected boolean triggerStartNow;

    // 触发器结束时间
    protected Date triggerEndTime;

    // 触发器的描述
    protected String triggerDescription;

}
